<?php
namespace Admin\Controller;
use Think\Controller;

class AttrController extends CommonController{
	/**
	 * 属性列表
	 */
	public function index(){
		$this->attr = M('attr')->select();
		$this->display();
	}
	/**
	 * 属性表单修改视图
	 */
	public function editAttr(){
		$this->attr = M('attr')->where(array('id'=>I('id','','int')))->find();
		$this->display();
	}
	/**
	 * 属性修改处理
	 */
	public function runEditAttr(){
		$data = array('id'=>I('id'),'color'=>I('color'));
		if(M('attr')->save($data)){
			$this->success('修改成功',U('index'));
		}else{
			$this->error('修改失败');
		}
	}
}